<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<html>

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
		<title>Build Menu</title>
		<link href="resources/CSS/Featured.css" rel="stylesheet" type="text/css"/>
	</head>
	
	<script language="JavaScript">
		
		
		function validate(form){
			if(form.menuName.value == ""){
				alert("Please give the menu a name.");
				form.menuName.focus();
			}	
			else{
				form.submit();
			}	
		}
		
	</script>
	
	<body>
		
		<br />
		
		<div class='center'>
			<form name='menuForm' action="MenuCreation" method="post">
				
				<span>
					<b>Menu Name:</b> <input type='text' name='menuName' />
				</span>
				
				<br />
			
				<table>
					<tr>
						<td>
							<h1>Main Course:</h1>
							
							<hr />
							
							<table>
								<c:forEach items='${sessionScope.entrees}' var='entree'>
									<tr>
										<td>${entree.name}:</td> 
										<td> x </td>
										<td><input name='entree' type='text' size="3" onkeyup="this.value=this.value.replace(/[^\d]/,'')" value=''/></td>
									</tr>
								</c:forEach>
							</table>
						</td>
					</tr>
						
					<tr>
						<td>
							<h1>Side Dishes:</h1>
							
							<hr />
							
							<table>
								<c:forEach items='${sessionScope.sides}' var='side'>
									<tr>
										<td>${side.name}:</td> 
										<td> x </td>
										<td><input name='side' type='text' size="3" onkeyup="this.value=this.value.replace(/[^\d]/,'')" value=''/></td>
									</tr>
								</c:forEach>
							</table>
						</td>
					</tr>
					
					<tr>
						<td>
							<h1>Drinks:</h1>
							
							<hr />
							
							<table>
								<c:forEach items='${sessionScope.drinks}' var='drink'>
									<tr>
										<td>${drink.name}:</td> 
										<td> x </td>
										<td><input name='drink' type='text' size="3" onkeyup="this.value=this.value.replace(/[^\d]/,'')" value=''/></td>
									</tr>
								</c:forEach>
							</table>
						</td>
					</tr>
				</table>
				
			<br />
			<br />
			<br />
				
			<input type="button" class='glass' value="Submit" onclick = "validate(this.form)"> 

			</form>
		
		</div>
		
	</body>

</html>